package com.scuec.tourismwebsite.mapper;



import com.scuec.tourismwebsite.entity.WeatherTourism;
import com.scuec.tourismwebsite.vo.ViewWeatherTourism;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WeatherTourismMapper {
    @Select("select wt.idweather_tourism,c.city_id,c.city_name, c.province,  wt.popular_attraction_name, wt.popular_attraction_description,wt. popular_attraction_image,wt.recommendation_index"+
            " from weather_tourism wt join city c on wt.city_id = c.city_id")
    List<ViewWeatherTourism> findViewWeatherTourism();

    @Insert("insert into weather_tourism (city_id,popular_attraction_name, popular_attraction_description, popular_attraction_image, recommendation_index)" +
            "values (#{city_id},#{popular_attraction_name}, #{popular_attraction_description}, #{popular_attraction_image}, #{recommendation_index})")
    Integer insertWeatherTourism(WeatherTourism weatherTourism);

    @Update("update weather_tourism set popular_attraction_name = #{popular_attraction_name}, " +
            "popular_attraction_description = #{popular_attraction_description}, " +
            "popular_attraction_image = #{popular_attraction_image}, " +
            "recommendation_index = #{recommendation_index}, " +
            "city_id = #{city_id} " +
            "where idweather_tourism = #{idweather_tourism}")
    Integer updateWeatherTourism(WeatherTourism weatherTourism);

    @Delete("delete from weather_tourism where idweather_tourism = #{idweather_tourism}")
    Integer deleteWeatherTourism(Integer idweather_tourism);
}
